import request from '@api/service.js'
import faker from 'faker'

export function settlementList (query) {
  return request({
    url: '/finance/settlement/list',
    method: 'get',
    params: query,
    mock: true,
    data: {
      'totalCount': 100,
      'pageSize': 10,
      'totalPage': 10,
      'currPage': 1,
      'list|10': [{
        'id|+1': 1,
        'tenantName': faker.name.findName(),
        'roomNumber': '10${index + 1}',
        'amount': faker.random.number({ min: 50, max: 300 }),
        'rechargeTime': faker.date.recent().toISOString().split('T')[0] + ' ' + faker.time.recent(),
        'paymentMethod': function () {
          const methods = ['微信', '支付宝', '现金', '银行卡']
          return methods[faker.random.number(methods.length - 1)]
        },
        'operator': '管理员'
      }]
    }
  })
}

export function reconciliationList (query) {
  return request({
    url: '/finance/reconciliation/list',
    method: 'get',
    params: query,
    mock: true,
    data: {
      'totalCount': 50,
      'pageSize': 10,
      'totalPage': 5,
      'currPage': 1,
      'list|10': [{
        'id|+1': 1,
        'date': faker.date.past().toISOString().split('T')[0],
        'totalAmount': faker.finance.amount(100, 1000, 2),
        'reconciledAmount': faker.finance.amount(50, 900, 2),
        'unreconciledAmount': faker.finance.amount(10, 100, 2)
      }]
    }
  })
}


